package com.itheima;

import com.itheima.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AopController {
    @Autowired
    UserService userService;

    @RequestMapping("/hello")
    public String sayHello() {
        System.out.println("hello");
        return "success";
    }

    @RequestMapping("/addUser")
    public String addUser(@RequestParam("name") String name) {
        System.out.println(userService.getClass().getName());
        int result = userService.addUser();
        return result+"success";
    }
}
